import { MultipartFile } from '@fastify/multipart';
import { ApiProperty } from '@nestjs/swagger';
import { IsDefined, IsInt, IsOptional, IsString, Min } from 'class-validator';
import { PagerDto } from '~/common/dto/pager.dto';
import { IsFile } from '~/modules/tools/upload/file.constraint';

export class CreatePointsGoodsDto {
  @ApiProperty({ type: 'string', description: '商品名称', required: true })
  @IsString()
  name: string;

	@ApiProperty({ type: 'string', description: '商品描述' })
  @IsString()
  @IsOptional()
  description: string;

  @ApiProperty({ type: 'number', description: '兑换所需积分', required: true })
  @IsInt()
  price: number;

  @ApiProperty({ type: 'string', description: '图片' })
	@IsString()
  @IsOptional()
  image: string;
}

export class FindPointsGoodsListDto extends PagerDto {
	@ApiProperty({ type: 'string', description: '商品名称（模糊查询）', required: false })
	@IsString()
  @IsOptional()
	name?: string;

  @ApiProperty({ type: 'number', description: '最小价格', required: false })
  @IsOptional()
  @IsInt()
  @Min(0)
  minPrice?: number;

  @ApiProperty({ type: 'number', description: '最大价格', required: false })
  @IsOptional()
  @IsInt()
  @Min(0)
  maxPrice?: number;
}

export class UpdatePointsGoodsDto {
  @ApiProperty({ type: 'string', description: '商品名称', required: false })
  @IsString()
  @IsOptional()
  name?: string;

  @ApiProperty({ type: 'string', description: '商品描述', required: false })
  @IsString()
  @IsOptional()
  description?: string;

  @ApiProperty({ type: 'number', description: '兑换所需积分', required: false })
  @IsInt()
  @IsOptional()
  price?: number;

  @ApiProperty({ type: 'string', description: '图片', required: false })
  @IsString()
  @IsOptional()
  image?: string;
}